import 'package:flutter/material.dart';
import 'package:flutterapp2/model/person.dart';
import 'package:fluttertoast/fluttertoast.dart';

class LayoutDemo extends StatelessWidget {
  // const声明类成员变量时，const变量必须同时被声明为static的。
  static const List<int> LIST = [];

  void fun0(){
    var person = Person(code: "111");
    final code = person.code;
//    const code2 = person.code;
    const list = [1,2,3];
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('水平方向布局'),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          RaisedButton(
            onPressed: () {
//              print('点击红色按钮事件');
              Fluttertoast.showToast(msg: "点击红色按钮事件");
            },
            color: const Color(0xffcc0000),
            child: new Text('红'),
          ),
          Row(children: <Widget>[
            RaisedButton(
              onPressed: () {
                print('点击红色按钮事件');
              },
              color: const Color(0xffcc0000),
              child: new Text('红'),
            ),
            Expanded(
              flex: 1,
              child: new RaisedButton(
                onPressed: () {
                  print('点击黄色按钮事件');
                },
                color: const Color(0xfff1c232),
                child: new Text('黄色按钮'),
              ),
            ),
            Expanded(
              flex: 1,
              child: RaisedButton(
                onPressed: () {
                  print('点击粉色按钮事件');
                },
                color: const Color(0xffea9999),
                child: new Text('粉色按钮'),
              ),
            ),
          ]),
          Row(children: <Widget>[
            new RaisedButton(
              onPressed: () {
                print('点击红色按钮事件');
              },
              color: const Color(0xffcc0000),
              child: new Text('红色按钮'),
            ),
            new RaisedButton(
              onPressed: () {
                print('点击黄色按钮事件');
              },
              color: const Color(0xfff1c232),
              child: new Text('黄色按钮'),
            ),
            Flexible(
              flex: 1,
              fit: FlexFit.tight,
              child: new RaisedButton(
                onPressed: () {
                  print('点击粉色按钮事件');
                },
                color: const Color(0xffea9999),
                child: new Text('粉色按钮'),
              ),
            ),
          ]),
        ],
      ),
    );
  }
}
